<template>
  <h1>订单数量：{{ sum }}</h1>
  <button @click="countUp">+1</button>
</template>

<script lang="ts" name="Orders" setup>
import {ref, watch} from 'vue'

const sum = ref(0)

function countUp() {
  sum.value++
}

watch(sum, (newVal, oldVal) => {
  console.log('sum changed', newVal, oldVal)
})
</script>

<style scoped>
h1 {
  color: rgba(122, 194, 255, 0.49);
}
</style>